// organizer-storage.js
Organizer.Storage = (function(){
    var LocalStorage = {};


    var organizerDBObject = [
        {
            'id': 1,
            'type': 'task',
            'title': "Throw the garbage.",
            'enddate_day': '30',
            'enddate_month': '06',
            'enddate_year': '2013',
            'priority': 1,
            'active': true,
            'shortdescription': 'A short description of an entry.',
            'description': 'The full description for this entry.'
        },
    {
        'id': 2,
        'type': 'event',
        'title': "Mountain adventure with the group.",
        'startdate_day': '25',
        'startdate_month': '06',
        'startdate_year': '2013',
        'enddate_day': '30',
        'enddate_month': '06',
        'enddate_year': '2013',
        'priority': 1,
        'active': true,
        'shortdescription': 'Let\'s get back together once again for a fun trek.',
        'description': 'This is, once again, our regular walk/climb in the ' +
            'mountain, me and my buddies: John, Jack, Mathew and Bachi Kiko.'
    },
                {
                    'id': 3,
                    'type': 'anniversary',
                    'title': "Andi\'s BDay",
                    'date_day': '14',
                    'date_month': '07',
                    'date_year': '2013',
                    'priority': 1,
                    'active': true,
                    'shortdescription': '',
                    'description': ''
                },
                {
                    'id': 4,
                    'type': 'task',
                    'title': "Make (buy) dinner for the honey.",
                    'enddate_day': '30',
                    'enddate_month': '06',
                    'enddate_year': '2013',
                    'priority': 1,
                    'active': true,
                    'shortdescription': 'Didn\'t really think you would cook, did you?',
                    'description': ''
                },
                {
                    'id': 5,
                    'type': 'task',
                    'title': "Get the dog for a walk.",
                    'enddate_day': '30',
                    'enddate_month': '06',
                    'enddate_year': '2013',
                    'priority': 1,
                    'active': true,
                    'shortdescription': '',
                    'description': ''
                },
                {
                    'id': 6,
                    'type': 'event',
                    'title': "A meeting of the vipusk.",
                    'startdate_day': '3',
                    'startdate_month': '07',
                    'startdate_year': '2013',
                    'enddate_day': '10',
                    'enddate_month': '07',
                    'enddate_year': '2013',
                    'priority': 1,
                    'active': true,
                    'shortdescription': 'Seeing the old bastards.',
                    'description': '',
                    'location': 'Bulgaria, Sunny Beach'
                },
                {
                    'name': 'Default List',
                    'type': 'list',
                    'entries': [4,5,6] // list of entry IDs
                },
                {
                    'name': 'List 2',
                    'type': 'list',
                    'entries': [5, 4] // list of entry IDs
                }];


    var TaffyDB = (function() {

        var organizerDb = TAFFY(organizerDBObject);

        return {

            getAllLists: function () {
                var lists = organizerDb({ type: 'list' }).get();
                return lists;
            },
            getList: function(listName) {
                var listEntryIDs = organizerDb({ type: 'list' , name: listName}).first().entries;
                var entries = organizerDb({ type: ['task', 'event', 'anniversary'] }, { id: listEntryIDs }).get()
                //Organizer.getInstance().addList()
                return entries;
            }
        }
    })();

    //var organizerDBObject



    return {
        LocalStorage: LocalStorage,
        GetOrganizerDataFromLocalStorage: function () {
            return organizerDBObject;
        },
        TaffyDB: TaffyDB
    }
})();